﻿using GameCreator.Core;
using Gp.Scripts.Core;
using UnityEngine;

namespace Gp.GCX {
    [AddComponentMenu("")]
    public class RestrictMovementAc : IAction {
        public bool isRestrict = true;
        
        public override bool InstantExecute(GameObject target, IAction[] actions, int index) {
            MainArchitecture.Interface.SendEvent(new RestrictMovementCommand(isRestrict));
            return true;
        }

#if UNITY_EDITOR

        public new static string NAME = "Gp/角色/玩家行动限制";
        private const string NODE_TITLE = "玩家行动: {0}";

        public override string GetNodeTitle() {
            return string.Format(NODE_TITLE, isRestrict ? "限制" : "正常");
        }

#endif
    }
}